package deng.jbservice.examples.jpa;

import java.util.List;

import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceUnit;

@Stateless
@Local(UserDal.class)
public class UserDalBean implements UserDal {
	
	@PersistenceUnit(unitName="jpa-examples")
	private EntityManager em;
	
	@Override
	public List<User> findAllUsers() {
		@SuppressWarnings("unchecked")
		List<User> result = (List<User>)em.createQuery("select e from User e").getResultList();
		return result;
	}

}
